package 网络通信1;
/*1.创建服务员
 *2.创建盘子接受韭菜
 *3.撤走服务员
 */
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

public class Server {
	public static void main(String[] args) throws Exception
	{
		System.out.println("-------服务端启动成功-------");
		//1.创建服务端程序的端口对象
		DatagramSocket socket=new DatagramSocket(6666);
		//2.创建接收数据包对象
		byte[] buffer=new byte[1024*64];
		DatagramPacket packet=new DatagramPacket(buffer,buffer.length);
		socket.receive(packet);
		int len=packet.getLength();
		System.out.println(new String(buffer,0,len));
		socket.close();
	}
}